Browse Source

[REF] b_purchase_manual_date_planned : blacken everything

pull/127/head
Elouan Le Bars 5 years ago
parent
commit
029dd0404f
  1. 18
      beesdoo_purchase_manual_date_planned/__openerp__.py
  2. 15
      beesdoo_purchase_manual_date_planned/models/purchase.py

18
beesdoo_purchase_manual_date_planned/__openerp__.py

@ -1,31 +1,25 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
{ {
'name': "Bees Purchase Manual date planned",
'name': "Beescoop Purchase - Manual date planned",
'summary': """ 'summary': """
Extension du module Purchase to set manually the date planned for the whole purchase.order""",
Extension of module Purchase to manually set the planned date for the whole purchase.order
""",
'description': """ 'description': """
Long description of module's purpose
""", """,
'author': "Beescoop - Cellule IT",
'author': "Beescoop - Cellule IT, Elouan Le Bars",
'website': "https://github.com/beescoop/Obeesdoo", 'website': "https://github.com/beescoop/Obeesdoo",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
# for the full list
'category': 'Purchase', 'category': 'Purchase',
'version': '0.1',
'version': '9.0.1.0.1',
# any module necessary for this one to work correctly
'depends': ['purchase'], 'depends': ['purchase'],
# always loaded
'data': [ 'data': [
'views/purchase_order.xml', 'views/purchase_order.xml',
'report/report_purchaseorder.xml', 'report/report_purchaseorder.xml',
], ],
# only loaded in demonstration mode
'demo': [],
} }

15
beesdoo_purchase_manual_date_planned/models/purchase.py

@ -1,12 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, api, fields from openerp import models, api, fields
class PurchaseOrder(models.Model): class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
_inherit = "purchase.order"
manual_date_planned = fields.Datetime(string='Scheduled Date', required=True)
manual_date_planned = fields.Datetime(
string="Scheduled Date", required=True
)
@api.onchange('order_line', 'order_line.date_planned')
@api.onchange("order_line", "order_line.date_planned")
def _on_change_manual_date_planned(self): def _on_change_manual_date_planned(self):
""" """
Since we don't see the date planned on the line anymore Since we don't see the date planned on the line anymore
@ -15,7 +18,7 @@ class PurchaseOrder(models.Model):
for line in self.order_line: for line in self.order_line:
if line.date_planned and not self.manual_date_planned: if line.date_planned and not self.manual_date_planned:
self.manual_date_planned = line.date_planned self.manual_date_planned = line.date_planned
break;
break
@api.multi @api.multi
def button_confirm(self): def button_confirm(self):
@ -24,5 +27,7 @@ class PurchaseOrder(models.Model):
hide them, we call the method to set the date planned on the line at the confirmation hide them, we call the method to set the date planned on the line at the confirmation
""" """
self.ensure_one() self.ensure_one()
self.with_context(date_planned=self.manual_date_planned).action_set_date_planned()
self.with_context(
date_planned=self.manual_date_planned
).action_set_date_planned()
return super(PurchaseOrder, self).button_confirm() return super(PurchaseOrder, self).button_confirm()
Loading…
Cancel
Save