Skip to content

Commit

Permalink
Merge PR #187 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
github-grap-bot committed Feb 19, 2025
2 parents 6c166fc + 326da29 commit b52eb7d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 3 deletions.
1 change: 1 addition & 0 deletions recurring_consignment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"demo/product_product.xml",
"demo/product_pricelist.xml",
"demo/account_move.xml",
"demo/ir_property.xml",
],
"post_init_hook": "create_consignor_sequence",
"installable": True,
Expand Down
23 changes: 23 additions & 0 deletions recurring_consignment/demo/ir_property.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2015 - Today: GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo noupdate="1">

<!-- Partner Properties -->
<record id="property_account_receivable" model="ir.property">
<field name="name">property_account_receivable_id</field>
<field name="company_id" ref="company"/>
<field name="fields_id" ref="account.field_res_partner__property_account_receivable_id"/>
<field name="value" eval="'account.account,'+str(account_receivable)"/>
</record>

<record id="property_account_payable" model="ir.property">
<field name="name">property_account_payable_id</field>
<field name="company_id" ref="company"/>
<field name="fields_id" ref="account.field_res_partner__property_account_payable_id"/>
<field name="value" eval="'account.account,'+str(account_payable)"/>
</record>
</odoo>
8 changes: 6 additions & 2 deletions recurring_consignment/demo/product_pricelist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<odoo>

<record id="sale_pricelist_10" model="product.pricelist">
<field name="company_id" ref="company" />
<field name="name">My Pricelist (-10%)</field>
<field name="currency_id" ref="base.USD" />
<field name="currency_id" ref="base.EUR" />
</record>

<record id="sale_pricelist_item_10" model="product.pricelist.item">
<field name="company_id" ref="company" />
<field name="applied_on">3_global</field>
<field name="pricelist_id" ref="sale_pricelist_10" />
<field name="compute_price">percentage</field>
Expand All @@ -20,12 +22,14 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
</record>

<record id="sale_pricelist_50" model="product.pricelist">
<field name="company_id" ref="company" />
<field name="name">My Pricelist (-50%)</field>
<field name="currency_id" ref="base.USD" />
<field name="currency_id" ref="base.EUR" />
<field name="consignment_pricelist_id" ref="sale_pricelist_10"/>
</record>

<record id="sale_pricelist_item_50" model="product.pricelist.item">
<field name="company_id" ref="company" />
<field name="applied_on">3_global</field>
<field name="pricelist_id" ref="sale_pricelist_50" />
<field name="compute_price">percentage</field>
Expand Down
5 changes: 5 additions & 0 deletions recurring_consignment/demo/product_product.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<record id="commission_product_vat_20" model="product.product" context="{'allowed_company_ids': [ref('recurring_consignment.company')]}">
<field name="name">Commission (20% Price Excl)</field>
<field name="detailed_type">service</field>
<field name="company_id" ref="recurring_consignment.company"/>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="fiscal_classification_id" ref="fiscal_classification_20_vat_exclude"/>
Expand All @@ -24,6 +25,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<!-- Product from Consignor #1 -->
<record id="consigned_product_consignor_1_vat_5_A" model="product.product">
<field name="name">My Consigned Product A (VAT 5% - Consignor 1)</field>
<field name="company_id" ref="recurring_consignment.company"/>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="consignor_partner_id" ref="consignor_1"/>
Expand All @@ -32,6 +34,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

<record id="consigned_product_consignor_1_vat_5_B" model="product.product">
<field name="name">My Consigned Product B (VAT 5% - Consignor 1)</field>
<field name="company_id" ref="recurring_consignment.company"/>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="consignor_partner_id" ref="consignor_1"/>
Expand All @@ -40,6 +43,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

<record id="consigned_product_consignor_1_vat_20_C" model="product.product">
<field name="name">My Consigned Product C (VAT 20% - Consignor 1)</field>
<field name="company_id" ref="recurring_consignment.company"/>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="consignor_partner_id" ref="consignor_1"/>
Expand All @@ -48,6 +52,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

<record id="consigned_product_consignor_1_vat_20_D" model="product.product">
<field name="name">My Consigned Product D (VAT 20% - Consignor 1)</field>
<field name="company_id" ref="recurring_consignment.company"/>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="consignor_partner_id" ref="consignor_1"/>
Expand Down
2 changes: 1 addition & 1 deletion recurring_consignment/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def action_post(self):
def _recurring_consigment_mark_as_paid(self):
# The first time a commission invoice is posted, create
# a Miscellanious Operation to transfer amount from 'Receivable' account
# to 'Receiable / Payable' account
# to 'Receivable / Payable' account
# and mark the invoice as paid

for move in self:
Expand Down
1 change: 1 addition & 0 deletions recurring_consignment/models/product_pricelist_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ProductPricelistItem(models.Model):
def _prepare_consignment_exception(self, pricelist, template):
return {
"pricelist_id": pricelist.id,
"company_id": template.company_id.id,
"product_tmpl_id": template.id,
"applied_on": "1_product",
"base": "pricelist",
Expand Down
3 changes: 3 additions & 0 deletions recurring_consignment/tests/test_pricelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class TestPricelist(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.company = cls.env.ref("recurring_consignment.company")
cls.ProductProduct = cls.env["product.product"]

cls.sale_pricelist_10 = cls.env.ref("recurring_consignment.sale_pricelist_10")
Expand Down Expand Up @@ -58,6 +59,7 @@ def test_12_pricelist_create_product_alternative(self):
product = self.ProductProduct.create(
{
"name": "New Product",
"company_id": self.company.id,
"categ_id": self.product_category.id,
"list_price": 100,
"consignor_partner_id": self.consignor_1.id,
Expand All @@ -72,6 +74,7 @@ def test_13_pricelist_create_product_normal(self):
product = self.ProductProduct.create(
{
"name": "New Product",
"company_id": self.company.id,
"categ_id": self.product_category.id,
"list_price": 100,
"consignor_partner_id": self.consignor_1.id,
Expand Down

0 comments on commit b52eb7d

Please sign in to comment.