changes in RoutingStep

This commit is contained in:
Elvis 2023-11-26 22:00:19 -05:00
parent 6ba94dcf5e
commit a6372e7e87
5 changed files with 42 additions and 0 deletions

View File

@ -19,6 +19,7 @@ def register():
production.ProductionCost,
production.SubProduction,
production.SubProductionIn,
production.RoutingStep,
account.Move,
stock.Move,
ir.Cron,

View File

@ -521,6 +521,30 @@ class ProductionCost(ModelSQL, ModelView):
return round(self.unit_price * Decimal(self.quantity), 2)
class RoutingStep(metaclass=PoolMeta):
__name__ = 'production.routing.step'
work_center = fields.Many2One('production.work.center', 'Work Center')
def get_work(self, production, work_center_picker):
"Return work instance for the production using the work center picker"
pool = Pool()
Work = pool.get('production.work')
work = Work()
work.sequence = self.sequence
work.operation = self.operation
work.production = production
work.company = production.company
if self.operation.work_center_category:
work.work_center = work_center_picker(
production.work_center, self.operation.work_center_category)
elif self.work_center:
work.work_center = self.work_center
else:
work.work_center = production.work_center
return work
class ProductionReport(CompanyReport):
'Production Report'
__name__ = 'production.report'

View File

@ -113,5 +113,11 @@ this repository contains the full copyright notices and license terms. -->
<field name="model">production,-1</field>
<field name="action" ref="wizard_production_force_draft"/>
</record>
<record model="ir.ui.view" id="routing_step_view_form">
<field name="inherit" ref="production_routing.routing_step_view_form"/>
<field name="model">production.routing.step</field>
<field name="name">routing_step_form</field>
</record>
</data>
</tryton>

View File

@ -6,6 +6,8 @@ depends:
product
account
production
production_work
production_routing
account_stock_latin
analytic_account
stock_co

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='sequence']" position="after">
<label name="work_center"/>
<field name="work_center"/>
</xpath>
</data>