Skip to content

Commit

Permalink
Merge pull request #147 from coopiteasy/9.0-mrp-brewing-improvements
Browse files Browse the repository at this point in the history
9.0 mrp brewing improvements
  • Loading branch information
Houssine BAKKALI authored Dec 21, 2020
2 parents 8f7293f + d0c12c3 commit b08a1b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions mrp_brewing/models/brew.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def get_bom(self):
store=True,
copy=False,
)
get_brew_number = fields.Boolean(string="Get brew number ?", default=True)
brew_number = fields.Char(string="Brew number", copy=False)
brew_beer_number = fields.Integer(string="Brew beer number", copy=False)
state = fields.Selection(
Expand Down Expand Up @@ -193,15 +194,16 @@ def action_confirm(self):
raise UserError(
_("You must first confirm the parent brew order.")
)
brew_sequence = parent_brew_order_id.brew_number
else:
brew_beer_number = (
self.product_id.brew_product_sequence.next_by_id()
)
brew_year_sequence = self.env["ir.sequence"].search(
[("code", "=", "brew.year.sequence")]
)
brew_year_number = brew_year_sequence.next_by_id()
brew_year_number = 0
if self.get_brew_number:
brew_year_number = brew_year_sequence.next_by_id()
self.write(
{
"state": "done",
Expand Down
5 changes: 4 additions & 1 deletion mrp_brewing/models/mrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ def _get_brew_order_name(self):
else:
master_mo = mo

mo.brew_order_name = master_mo.brew_orders[0].name
if master_mo.brew_orders:
mo.brew_order_name = master_mo.brew_orders[0].name
else:
mo.brew_order_name = '/'

# fixme not used
lot_number = fields.Many2one("stock.production.lot", string="Lot Number")
Expand Down
1 change: 1 addition & 0 deletions mrp_brewing/views/brew_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
</div>
<group>
<group>
<field name="get_brew_number"/>
<field name="brew_number"/>
<field name="brew_beer_number"/>
<field name="brew_declaration_id"/>
Expand Down

0 comments on commit b08a1b1

Please sign in to comment.