Skip to content

Commit ae66f7b

Browse files
committed
[MIG] account_fiscal_position_partner_type: Migration to 16.0
1 parent a902888 commit ae66f7b

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

account_fiscal_position_partner_type/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{
55
"name": "Account Fiscal Position Partner Type",
6-
"version": "15.0.1.0.0",
6+
"version": "16.0.1.0.0",
77
"category": "Accounting & Finance",
88
"website": "https://github.com/OCA/account-fiscal-rule",
99
"author": "Sygel Technology," "Odoo Community Association (OCA)",

account_fiscal_position_partner_type/models/account_fiscal_position.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ class AccountFiscalPosition(models.Model):
1515
)
1616

1717
@api.model
18-
def search(self, args, offset=0, limit=None, order=None, count=False):
18+
def search(self, domain, offset=0, limit=None, order=None, count=False):
1919
if self.env.context.get("fiscal_position_type"):
20-
args = expression.AND(
20+
domain = expression.AND(
2121
(
22-
args,
22+
domain,
2323
[
2424
(
2525
"fiscal_position_type",
@@ -30,21 +30,20 @@ def search(self, args, offset=0, limit=None, order=None, count=False):
3030
)
3131
)
3232
return super().search(
33-
args, offset=offset, limit=limit, order=order, count=count
33+
domain, offset=offset, limit=limit, order=order, count=count
3434
)
3535

3636
@api.model
37-
def get_fiscal_position(self, partner_id, delivery_id=None):
37+
def _get_fiscal_position(self, partner, delivery=None):
3838
fiscal_type = False
39-
if partner_id:
40-
delivery = self.env["res.partner"].browse(delivery_id or partner_id)
39+
if partner:
40+
delivery = delivery or partner
4141
# Only type has been configured
4242
if (
4343
delivery.fiscal_position_type
4444
and not delivery.property_account_position_id
4545
):
4646
fiscal_type = delivery.fiscal_position_type
47-
fp_id = super(
47+
return super(
4848
AccountFiscalPosition, self.with_context(fiscal_position_type=fiscal_type)
49-
).get_fiscal_position(partner_id=partner_id, delivery_id=delivery_id)
50-
return fp_id
49+
)._get_fiscal_position(partner=partner, delivery=delivery)

account_fiscal_position_partner_type/models/res_partner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ def _selection_fiscal_position_type(self):
2020

2121
@api.model
2222
def _commercial_fields(self):
23-
return super(ResPartner, self)._commercial_fields() + ["fiscal_position_type"]
23+
return super()._commercial_fields() + ["fiscal_position_type"]

0 commit comments

Comments
 (0)