-
-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][ADD] purchase_currency #2508
base: 16.0
Are you sure you want to change the base?
Conversation
2d45f77
to
75f9052
Compare
422192e
to
23a9399
Compare
@api.model | ||
def default_get(self, fields_list): | ||
result = super().default_get(fields_list) | ||
# Check currency_id field exists | ||
if "currency_id" not in fields_list: | ||
return result | ||
default_purchase_currency = self.env.company.default_purchase_currency_id | ||
if default_purchase_currency: | ||
result["currency_id"] = default_purchase_currency.id | ||
return result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@api.model | |
def default_get(self, fields_list): | |
result = super().default_get(fields_list) | |
# Check currency_id field exists | |
if "currency_id" not in fields_list: | |
return result | |
default_purchase_currency = self.env.company.default_purchase_currency_id | |
if default_purchase_currency: | |
result["currency_id"] = default_purchase_currency.id | |
return result | |
currency_id = fields.Many2one(default=lambda self: self._default_currency_id()) | |
def _default_currency_id(self): | |
company = self.env.company | |
return company.default_purchase_currency_id or company.currency_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
{ | ||
"name": "Purchase Currency", | ||
"version": "16.0.1.0.0", | ||
"category": "Purchases", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"category": "Purchases", | |
"category": "Purchase", |
|
||
def _purchase_service_prepare_order_values(self, supplierinfo): | ||
result = super()._purchase_service_prepare_order_values(supplierinfo) | ||
supplier_currency = supplierinfo.partner_id.property_purchase_currency_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we explicit with_company(self.company_id)
to be extra sure to get the currect currency? supplierinfo
should already have the company context from previous _purchase_service_create
, maybe we should doublecheck to make sure
@@ -0,0 +1,4 @@ | |||
Go to the Settings -> Purchase: | |||
|
|||
- Select a currency avaibale for the company in the "Default Purchase Currency" field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Select a currency avaibale for the company in the "Default Purchase Currency" field | |
- Set "Default Purchase Currency" with an available currency |
@@ -0,0 +1 @@ | |||
This module is useful when a company is operating in muli-currency environment and most of purchases are made in currency other that the main currency set in the company settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module is useful when a company is operating in muli-currency environment and most of purchases are made in currency other that the main currency set in the company settings. | |
This module is useful when a company operates in a muli-currency environment and most of the purchases are made in a currency other than the main currency of the company. |
@@ -0,0 +1 @@ | |||
Set default currency for the company purchase orders and vendor bills. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set default currency for the company purchase orders and vendor bills. | |
Set default currency for the company purchase orders. |
Would it just be purchase orders? Given that the currency carried itself to vendor bill, I don't think saying we are applying customization to both is valid.
Once module is configured, the default currency will be set: | ||
|
||
1. As the default value for the "Currency" field in Requst For Quotation | ||
2. As the default Journal Currency in Vendor Bill. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this valid?
Set default currency for the company purchase orders and vendor bills.