Wednesday, September 19, 2018
4 changes · master
Enhancements to existing features
Email scheduling now stores scheduled send times as proper date and time values instead of plain text. This makes scheduled emails easier for the system to process reliably and supports more accurate timing-related behavior.
Original PR description
Description of the issue/feature this PR addresses: scheduled_date changed to fields.Datetime Current behavior before PR: scheduled_date was fields.Char earlier Desired behavior after PR is merged: scheduled_date changed to fields.Datetime for effective use -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Point of Sale settings now let users choose from existing IoT boxes instead of manually entering an IP address. This reduces setup errors and makes hardware configuration easier, while making IoT a required dependency for Point of Sale.
Original PR description
Instead of typing the IP address of the box, the user will have to select an existing IoT box !! IoT as a dependency of Point of Sale !! Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Email scheduling fields now use a proper date and time format instead of plain text. This should make scheduled email setup more reliable and easier to use, especially when choosing dates and times.
Original PR description
Description of the issue/feature this PR addresses: scheduled_date fields from mail.mail and mail.template changed to fields.Datetime from fields.Char Current behavior before PR: When creating record in mail.mail or mail.template object, field scheduled_date is of type fields.Char Desired behavior after PR is merged: scheduled_date field changed to fields.Datetime for better datetime picking -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This change lets Odoo automatically update certain saved fields when related information changes, while still allowing users to override those values when needed. It reduces duplicated update logic and makes record creation and editing behave more consistently across forms and automated processes.
Original PR description
The idea is to avoid 'onchange' methods and replace them by 'compute' methods. Instead of fiscal_position = fields.Many2one('account.fiscal.position', string='Fiscal Position', readonly=True,…
The idea is to avoid 'onchange' methods and replace them by 'compute' methods.
Instead of
fiscal_position = fields.Many2one('account.fiscal.position', string='Fiscal Position',
readonly=True, states={'draft': [('readonly', False)]})
@api.onchange('partner_id')
def onchange_partner_fiscal_position(self):
self.fiscal_position = self.partner_id.property_account_position
we define
fiscal_position = fields.Many2one('account.fiscal.position', string='Fiscal Position',
compute='_compute_fiscal_position', store=True,
readonly=True, states={'draft': [('readonly', False)]})
@api.one
@api.depends('partner_id.property_account_position')
def _compute_fiscal_position(self):
self.fiscal_position = self.partner_id.property_account_position
So the onchange is defined as a computed field that can be modified by the user.
Behavior
an onchange triggered on 'partner_id' automatically invalidates 'fiscal_position' and recomputes it
write({'partner_id': pid}) automatically invalidates 'fiscal_position' and recomputes it
write({'partner_id': pid, 'fiscal_position': fp}) does not recompute 'fiscal_position'
create({'partner_id': pid}) automatically computes 'fiscal_position'
create({'partner_id': pid, 'fiscal_position': fp}) does not recompute 'fiscal_position'
The behavior covers:
onchange methods: potentially all onchange methods can be expressed as compute methods
create() and write() behave as if they had executed the onchange methods
Technically speaking
target: master
modify create() and write() to compute fields not provided but with a compute method
modify the field setup:
compute=... does not imply store=False
compute=... does not imply readonly=True
adapt documentation