Skip to content

Commit

Permalink
[MIG] subscription_oca: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
carolina-domatix committed Jan 15, 2024
1 parent 6dfa424 commit 3062b0d
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 49 deletions.
2 changes: 1 addition & 1 deletion subscription_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Subscription management",
"summary": "Generate recurring invoices.",
"version": "15.0.1.0.1",
"version": "16.0.1.0.0",
"development_status": "Beta",
"category": "Subscription Management",
"website": "https://github.com/OCA/contract",
Expand Down
4 changes: 2 additions & 2 deletions subscription_oca/models/sale_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _read_group_stage_ids(self, stages, domain, order):
string="Stage",
tracking=True,
group_expand="_read_group_stage_ids",
store="true",
store=True,
)
stage_str = fields.Char(
related="stage_id.name",
Expand Down Expand Up @@ -228,7 +228,7 @@ def onchange_partner_id_fpos(self):
self.fiscal_position_id = (
self.env["account.fiscal.position"]
.with_company(self.company_id)
.get_fiscal_position(self.partner_id.id)
._get_fiscal_position(self.partner_id)
)

def action_start_subscription(self):
Expand Down
2 changes: 1 addition & 1 deletion subscription_oca/models/sale_subscription_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _compute_tax_ids(self):
for line in self:
fpos = (
line.sale_subscription_id.fiscal_position_id
or line.sale_subscription_id.fiscal_position_id.get_fiscal_position(
or line.sale_subscription_id.fiscal_position_id._get_fiscal_position(
line.sale_subscription_id.partner_id.id
)
)
Expand Down
7 changes: 6 additions & 1 deletion subscription_oca/models/sale_subscription_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SaleSubscriptionStage(models.Model):

name = fields.Char(required=True, translate=True)
sequence = fields.Integer()
display_name = fields.Char(string="Display name")
display_name = fields.Char(string="Display name", compute="_compute_display_name")
in_progress = fields.Boolean(string="In progress", default=False)
fold = fields.Boolean(string="Kanban folded")
description = fields.Text(translate=True)
Expand All @@ -27,3 +27,8 @@ def _check_lot_product(self):
)
if len(post_stages) > 1:
raise ValidationError(_("There is already a Closed-type stage declared"))

@api.depends("name")
def _compute_display_name(self):
for stage in self:
stage.display_name = stage.name
1 change: 1 addition & 0 deletions subscription_oca/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* Carlos Martínez <[email protected]>
* Carolina Ferrer <[email protected]>


* `Ooops404 <https://www.ooops404.com>`__:
Expand Down
1 change: 1 addition & 0 deletions subscription_oca/tests/test_subscription_oca.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def test_subscription_oca_sale_order(self):
# SO standard flow
so = self.env["sale.order"].create(
{
"name": "Test SO",
"partner_id": self.partner.id,
"partner_invoice_id": self.partner.id,
"partner_shipping_id": self.partner.id,
Expand Down
12 changes: 5 additions & 7 deletions subscription_oca/views/sale_subscription_stage_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@

</group>
</group>
<group>
<field
name="description"
placeholder="Add new description..."
nolabel="1"
/>
</group>
<field
name="description"
placeholder="Add new description..."
nolabel="1"
/>
</sheet>
</form>
</field>
Expand Down
66 changes: 31 additions & 35 deletions subscription_oca/views/sale_subscription_template_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,32 @@

<form>
<sheet>
<group>
<div class="oe_button_box" name="button_box">
<button
name="action_view_product_ids"
type="object"
class="oe_stat_button"
icon="fa-pencil-square-o"
>
<field
name="product_ids_count"
widget="statinfo"
string="Products"
/>
</button>
<button
name="action_view_subscription_ids"
type="object"
class="oe_stat_button"
icon="fa-pencil-square-o"
>
<field
name="subscription_count"
widget="statinfo"
string="Subscriptions"
/>
</button>
</div>
</group>
<div class="oe_button_box" name="button_box">
<button
name="action_view_product_ids"
type="object"
class="oe_stat_button"
icon="fa-pencil-square-o"
>
<field
name="product_ids_count"
widget="statinfo"
string="Products"
/>
</button>
<button
name="action_view_subscription_ids"
type="object"
class="oe_stat_button"
icon="fa-pencil-square-o"
>
<field
name="subscription_count"
widget="statinfo"
string="Subscriptions"
/>
</button>
</div>
<div class="oe_title">
<h1>
<field
Expand Down Expand Up @@ -91,13 +89,11 @@
</group>
</page>
<page string="Terms and Conditions">
<group>
<field
nolabel="1"
name="description"
placeholder="Terms and Conditions"
/>
</group>
<field
nolabel="1"
name="description"
placeholder="Terms and Conditions"
/>
</page>
</notebook>

Expand Down
4 changes: 2 additions & 2 deletions subscription_oca/views/sale_subscription_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
<field
name="stage_id"
widget="statusbar"
clickable="1"
options="{'fold_field': 'fold'}"
options="{'fold_field': 'fold', 'clickable': '1'}"
/>

</header>
Expand Down Expand Up @@ -104,6 +103,7 @@
name="recurring_next_date"
attrs="{'invisible': ['|', ('recurring_next_date', '=', False), ('in_progress', '=', False)]}"
/>
<field name="company_id" invisible="1" />
<field
name="company_id"
options="{'no_create': True}"
Expand Down

0 comments on commit 3062b0d

Please sign in to comment.